﻿$.extend({
    starLevel_showTxt: function (index) {
        var result = "";
        switch (index) {
            case 1: result = "很差";
                break;
            case 2: result = "较差";
                break;
            case 3: result = "一般";
                break;
            case 4: result = "好";
                break;
            case 5: result = "很好";
                break;
            default: result = "一般";
        }
        return result;
    }
});
$.fn.starLevel = function () {
    var _this = $(this);
    var currentStar = 3;

    var items = _this.find('.star_item');
    items.each(function (index) {
        if (currentStar == index) {
            $(this).parent().removeClass().addClass('selectS' + currentStar);
            $(this).parent().prev(".dpCont").text($.starLevel_showTxt(index + 1));
            $("#rankHid").val(currentStar);
        }
        $(this).bind('click', function (event) {
            currentStar = index + 1;
            $(this).parent().removeClass().addClass('selectS' + currentStar);
            $("#rankHid").val(currentStar);
            event.preventDefault();
        }).bind('mouseover', function () {
            $(this).parent().removeClass().addClass('selectS' + (index + 1));
            $(this).parent().prev(".dpCont").text($.starLevel_showTxt(index + 1));
        }).bind('mouseout', function () {
            $(this).parent().removeClass().addClass('selectS' + currentStar);
            //$(this).parent().prev(".dpCont").text('');
        });
    });
}